<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%--
  Created by IntelliJ IDEA.
  User: wxc
  Date: 2021/10/19
  Time: 9:37
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>学生表</title>
    <script type="text/javascript">
        function del(sno) {
            var result=confirm("确认要删除吗？");
            if(result){
                location="/student/delete?sno="+sno;
            }
        }
    </script>
</head>
<body>
<table>
    <tr>
        <th>学号</th>
        <th>姓名</th>
        <th>性别</th>
        <th>电话</th>
        <th>地址</th>
        <th>生日</th>
        <th>邮箱</th>
    </tr>
    <c:forEach items="${students}" var="s">
        <tr>
            <td>${s.sno}</td>
            <td>${s.sname}</td>
            <td>${s.sex}</td>
            <td>${s.phone}</td>
            <td>${s.address}</td>
            <td><fmt:formatDate value="${s.birthday}" pattern="yyyy-MM-dd" type="date"/></td>
            <td>${s.email}</td>
            <td><a href="<c:url value="/student/delete?sno=${s.sno}"/>">删除</a></td>
            <td><a href="#" onclick="del(${s.sno})">删除</a></td>
            <td><button onclick="del(${s.sno})">删除</button></td>
            <td><a href="<c:url value="/student/findBySno?sno=${s.sno}"/>">修改</a></td>
        </tr>
    </c:forEach>
</table>
</body>
</html>
